#include "comm.hpp"
int main()
{

    Init init;

    int chmid = CreatShm();
    char *shmaddr = (char *)shmat(chmid, nullptr, 0);
    int fd = open(FIFO_FILE, O_RDONLY);
    if (fd < 0)
    {
        perror("open");
        exit(FIFO_OPEN_ERR);
    }
    while (true)
    {
        char c;
        int x = read(fd, &c, 1);
        if (x == 0)
            break;
        else if (x < 0)
            break;
        cout << "client asy@" << shmaddr << endl; // 直接访问共享内存
        // sleep(5);
    }
    shmdt(shmaddr);
    shmctl(chmid, IPC_RMID, nullptr);
    return 0;
}